package com.erp.listener;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RocketMQMessageListener(consumerGroup = "work-server", topic = "TopicTest")
public class RocketmqService implements RocketMQListener<MessageExt> {

    @Override
    public void onMessage(MessageExt message) {
        String name = message.getUserProperty("name");
        log.info("name:{}", name);
        log.info("Received message: {}", new String(message.getBody()));
    }
}
